﻿using System;

namespace HouseObj
{
    [Serializable]
    /// <summary>
    /// //小区数据对象
    /// </summary>
    public class MyHouseHoodInfo
    {
        #region Members
        /// <summary>
        /// //小区名称
        /// </summary>
        public string name;
        /// <summary>
        /// //小区所在城市
        /// </summary>
        public string city;
        /// <summary>
        /// ///小区所在区域
        /// </summary>
        public string region;
        /// <summary>
        /// //房屋均价
        /// </summary>
        public double avePrice;
        /// <summary>
        /// //在售房屋数量
        /// </summary>
        public int houseNum;
        /// <summary>
        /// //实景图链接
        /// </summary>
        public string realMapUrl;
        /// <summary>
        /// //小区详细信息链接
        /// </summary>
        public string detailUrl;
        /// <summary>
        /// //网址链接
        /// </summary>
        public string url;
        #endregion

        #region Constructors
        /// <summary>
        /// //构造函数，给各字段赋值
        /// </summary>
        public MyHouseHoodInfo(string name, string city, string region, string avePrice, string houseNum, string realMapUrl, string detailUrl, string url)
        {
            this.name = name;
            this.city = city;
            this.region = region;
            this.avePrice = avePrice == "" ? 0 : Convert.ToDouble(avePrice);
            this.houseNum = houseNum == "" ? 0 : Convert.ToInt32(houseNum);
            this.realMapUrl = realMapUrl;
            this.detailUrl = detailUrl;
            this.url = url;
        }
        #endregion

        #region Methods
        /// <summary>
        /// //重载ToString函数
        /// </summary>
        /// <returns>当前对象的字符串</returns>
        public override string ToString()
        {
            string msg = string.Empty;
            msg += "\"" + name + "\",";
            msg += "\"" + city + "\",";
            msg += "\"" + region + "\",";
            msg += avePrice.ToString() + ",";
            msg += houseNum.ToString() + ",";
            msg += "\"" + realMapUrl + "\",";
            msg += "\"" + detailUrl + "\",";
            msg += "\"" + url + "\"";
            return msg;
        }
        #endregion
    }
}
